package jen.android.JenLock.manager;

import jen.android.JenLock.Logger;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;

public class PreferenceManager {

	SharedPreferences pref;
	SharedPreferences.Editor editor;
	
	Context context;
	
	//==========================================================
	
/*	public PreferenceManager(Context context){
		this.context = context;
	}*/
	
	public void setContext(Context context){
		this.context = context;
	}
	
	public boolean loadSetValue(){

		try{
			pref = context.getSharedPreferences("pref", context.MODE_PRIVATE);
			editor = pref.edit();
		}catch(Throwable th){
			return false;
		}
		
		return true;
	}
	
	public void setScreenLock(int check) {
		
		Logger.l("Preferen~ Manager   :   Screen lock function operate ================== ");
		editor.putInt("lock", check);
		editor.commit();		
	}

	public int getLockStatus() {
		return pref.getInt("lock", 0);
	}

	public void setbootCheck(int check) {
		
		Log.e("JLOCK", "=LockControl= Boot Flag set   " + check);
		editor.putInt("boot", check);
		editor.commit();
	}


	public int getbootCheck() {
		return pref.getInt("boot", 0);
	}

	public void saveStatus(int status) {}

	public int getStatus() {
		return 0;
	}

	public boolean getfirstSetup(){
		return pref.getBoolean("firstrun", false);
	}
	
	public void setfirstSetup()	{
		Log.e("JLOCK", "Preference up :: first Setup set true");
		editor.putBoolean("firstrun", true);
		editor.commit();
	}
	
	public void setLauncherInfo(String packagename, String classname){
		editor.putString("packagename", packagename);
		editor.putString("classname", classname);
		editor.commit();
	}
	
	public String getLauncherPackage(){
		return pref.getString("packagename", "empty");
	}
	
	public String getLauncherClassname(){
		return pref.getString("classname", "empty");
	}
	
	/*public void setSettingPageMode(int check){
		Logger.l("Preferen~ Manager   :   Setting Mode check "+check+"  ================== ");
		editor.putInt("setting", check);
		editor.commit();
	}
	
	public int getSettingPageMode(){
		Logger.l("Preferen~ Manager   :  get SettingMode value  "+pref.getInt("setting", 0)+" ================== ");
		return pref.getInt("setting", 0);
	}*/
}
